package com.neudu.yiyang.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.neudu.yiyang.pojo.Nurserecord;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.neudu.yiyang.pojo.NurserecordDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;

/**
* @author 86156
* @description 针对表【nurserecord】的数据库操作Mapper
* @createDate 2025-04-23 08:47:24
* @Entity com.neudu.yiyang.pojo.Nurserecord
*/
@Mapper
public interface NurserecordMapper extends BaseMapper<Nurserecord> {
    @Select("SELECT nr.*, c.customer_name AS customerName " +
            "FROM nurserecord nr LEFT JOIN customer c ON nr.customer_id = c.id " +
            "WHERE nr.is_deleted = 0 " +
            "AND (#{customerName} IS NULL OR c.customer_name LIKE CONCAT('%',#{customerName},'%'))")
    Page<NurserecordDTO> selectWithCustomerForce(Page<NurserecordDTO> page, @Param("customerName") String customerName);
}

